Skip to content

fix: handle error message for special characters in Identifier of Project#9059

Merged
sriramveeraghanta merged 2 commits into
makeplane:previewfrom
durgeshhhhhhh:fix/project-name-special-char-error-handling
Jun 3, 2026
Merged

fix: handle error message for special characters in Identifier of Project#9059
sriramveeraghanta merged 2 commits into
makeplane:previewfrom
durgeshhhhhhh:fix/project-name-special-char-error-handling

Conversation

@durgeshhhhhhh
Copy link
Copy Markdown
Contributor

@durgeshhhhhhh durgeshhhhhhh commented May 12, 2026

Description

Root Cause:
In February 2026, PR #8529 added a validate_name() method in the Django serializer (apps/api/plane/app/serializers/project.py) that raises a PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS validation error when a project name matches the forbidden characters pattern defined in apps/api/plane/db/models/project.py:

FORBIDDEN_IDENTIFIER_CHARS_PATTERN = r"^.*[&+,:;$^}{*=?@#|'<>.()%!-].*$"

The API returns this error code in the response, which reaches the frontend through the project service. However, the onSubmit catch block in apps/web/ce/components/projects/create/root.tsx only handled PROJECT_NAME_ALREADY_EXIST and PROJECT_IDENTIFIER_ALREADY_EXIST — the new error code was never handled, causing it to silently fall into the generic "Something went wrong" toast with no actionable feedback for the user.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Before:
Generic "Something went wrong" toast shown when creating a project with special characters in the name.
Screenshot 2026-05-08 at 5 19 10 PM
After:
Specific and actionable error message "Project name cannot contain special characters." is now shown.
Screenshot 2026-05-12 at 9 54 20 PM

Test Scenarios

  1. Create a project with special characters in the name (e.g. Project + TEST #) → now shows "Project name cannot contain special characters." ✅
  2. Create a project with a duplicate name → still shows "Project name already taken" ✅
  3. Create a project with a duplicate identifier → still shows "Project identifier already taken" ✅
  4. Create a valid project → creates successfully ✅

References

Closes #8969

Summary by CodeRabbit

  • Bug Fixes
    • Project creation flow now reliably advances to the next step after a successful create.
    • Validation errors for project names containing special characters now show a clear, specific message instead of a generic collision error.
    • The update form also surfaces the same dedicated validation message to ensure consistent feedback when editing project names.

Copilot AI review requested due to automatic review settings May 12, 2026 16:58
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

📝 Walkthrough

Walkthrough

The CreateProjectForm component now properly handles backend validation errors when project names contain special characters. It detects the specific error code, sets a flag, and displays a dedicated localized toast message. The form also returns immediately after successful project creation to ensure proper navigation to the next step.

Changes

Special Characters Validation Error Handling

Layer / File(s) Summary
Form error detection and display for special characters
apps/web/ce/components/projects/create/root.tsx, apps/web/core/components/project/form.tsx
Creation success handler now returns handleNextStep(res.id) to advance flow. Both creation and update handlers derive nameSpecialCharError from backend payloads matching PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS and show a localized project_name_cannot_contain_special_characters toast when present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code both near and far,
Caught a stray plus and mended the scar.
A toast now sings where errors hide,
Smooth steps onward — no crash to bide. 🥕

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The title references 'Identifier of Project' but the actual changes handle special characters in project names across both creation and update flows, not specifically identifiers. Revise the title to reflect that the PR handles special character validation in project names during both creation and update flows, e.g., 'fix: handle special character validation in project name fields'
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description includes root cause analysis, type of change, comprehensive test scenarios, before/after screenshots, and issue reference following the template structure.
Linked Issues check ✅ Passed The PR addresses the core requirement from #8969 by handling PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS in both project creation [root.tsx] and update [form.tsx] flows with specific error messages.
Out of Scope Changes check ✅ Passed All changes are directly aligned with #8969 requirements: error handling for special character validation in both project creation and update flows with appropriate user feedback.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 12, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the project creation UX by mapping the API’s PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS validation error to a specific, localized toast message instead of falling back to a generic error.

Changes:

  • Handle PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS in the project creation form error handler.
  • Add a new i18n translation key (project_name_cannot_contain_special_characters) across supported locales.
  • Minor promise-chain adjustment to return handleNextStep(res.id).

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/web/ce/components/projects/create/root.tsx Adds frontend handling for the new project-name special-character validation error code.
packages/i18n/src/locales/en/translations.ts Adds English translation for the new toast message.
packages/i18n/src/locales/cs/translations.ts Adds Czech translation for the new toast message.
packages/i18n/src/locales/de/translations.ts Adds German translation for the new toast message.
packages/i18n/src/locales/es/translations.ts Adds Spanish translation for the new toast message.
packages/i18n/src/locales/fr/translations.ts Adds French translation for the new toast message.
packages/i18n/src/locales/id/translations.ts Adds Indonesian translation for the new toast message.
packages/i18n/src/locales/it/translations.ts Adds Italian translation for the new toast message.
packages/i18n/src/locales/ja/translations.ts Adds Japanese translation for the new toast message.
packages/i18n/src/locales/ko/translations.ts Adds Korean translation for the new toast message.
packages/i18n/src/locales/pl/translations.ts Adds Polish translation for the new toast message.
packages/i18n/src/locales/pt-BR/translations.ts Adds Brazilian Portuguese translation for the new toast message.
packages/i18n/src/locales/ro/translations.ts Adds Romanian translation for the new toast message.
packages/i18n/src/locales/ru/translations.ts Adds Russian translation for the new toast message.
packages/i18n/src/locales/sk/translations.ts Adds Slovak translation for the new toast message.
packages/i18n/src/locales/tr-TR/translations.ts Adds Turkish translation for the new toast message.
packages/i18n/src/locales/ua/translations.ts Adds Ukrainian translation for the new toast message.
packages/i18n/src/locales/vi-VN/translations.ts Adds Vietnamese translation for the new toast message.
packages/i18n/src/locales/zh-CN/translations.ts Adds Simplified Chinese translation for the new toast message.
packages/i18n/src/locales/zh-TW/translations.ts Adds Traditional Chinese translation for the new toast message.

Comment on lines 120 to +147
@@ -136,6 +137,14 @@ export const CreateProjectForm = observer(function CreateProjectForm(props: TCre
message: t("project_identifier_already_taken"),
});
}

if (nameSpecialCharError) {
setToast({
type: TOAST_TYPE.ERROR,
title: t("toast.error"),
message: t("project_name_cannot_contain_special_characters"),
});
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The identifier input already has frontend-level protection via projectIdentifierSanitizer in packages/utils/src/project.ts, which strips special characters on every keystroke before the value is stored in the form. This is wired up in apps/web/core/components/project/create/common-attributes.tsx via handleIdentifierChange. Special characters physically cannot be typed into the identifier field, so PROJECT_IDENTIFIER_CANNOT_CONTAIN_SPECIAL_CHARACTERS cannot be triggered from the project creation form.

However, since the backend API does handle this case in ProjectSerializer.validate_identifier(), I'm happy to add a defensive handler on the frontend as an extra safety layer if the maintainers feel it's necessary.

project_created_successfully_description: "Project created successfully. You can now start adding work items to it.",
project_name_already_taken: "The project name is already taken.",
project_identifier_already_taken: "The project identifier is already taken.",
project_name_cannot_contain_special_characters: "Project name cannot contain special characters.",
@durgeshhhhhhh durgeshhhhhhh force-pushed the fix/project-name-special-char-error-handling branch from 4a25fe7 to e1a9d29 Compare May 15, 2026 08:20
@Rahban1
Copy link
Copy Markdown

Rahban1 commented May 17, 2026

I also got the same issue, thought of fixing it, then saw this PR. This seems to fix the issue, should be merged.

@durgeshhhhhhh
Copy link
Copy Markdown
Contributor Author

Thanks @Rahban1, Glad it helped. Hoping it gets merged soon.

@durgeshhhhhhh
Copy link
Copy Markdown
Contributor Author

Hi @sriramveeraghanta, please review this when you have a chance. Been waiting eagerly

@Rahulcheryala
Copy link
Copy Markdown
Contributor

Hey @durgeshhhhhhh, great fix! One thing to address before we can merge, the same gap exists in the project update/settings flow. The handleUpdateChange catch block has the identical error-handling pattern but is missing the PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS case. Renaming an existing project to a name with special characters will still silently fall through to the generic "Something went wrong" toast.

Could you add handling for that error code in the update flow as well and push an update?

@Rahulcheryala Rahulcheryala self-requested a review June 1, 2026 15:20
@durgeshhhhhhh
Copy link
Copy Markdown
Contributor Author

Hey @Rahulcheryala, thanks for catching that. You're right, the update flow has the same gap. Adding the handling for PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS in handleUpdateChange now and will push shortly.

@durgeshhhhhhh
Copy link
Copy Markdown
Contributor Author

Hey @Rahulcheryala @sriramveeraghanta, the update flow is now handled as well.

Before : Renaming a project to a name with special characters failed silently with a generic "Something went wrong" toast.
Screenshot 2026-06-02 at 5 18 45 PM

After : It now shows the proper error message.
Screenshot 2026-06-02 at 5 17 01 PM

Both the create and update flows are covered in this PR now. Would love your review whenever you get a chance.

Copy link
Copy Markdown
Contributor

@Rahulcheryala Rahulcheryala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@durgeshhhhhhh
Copy link
Copy Markdown
Contributor Author

Thanks for the review @Rahulcheryala. Happy to help with anything else down the line.

@sriramveeraghanta sriramveeraghanta changed the title fix: handle PROJECT_NAME_CANNOT_CONTAIN_SPECIAL_CHARACTERS error in p… fix: handle error message for special characters in Identifier of Project Jun 3, 2026
@sriramveeraghanta sriramveeraghanta merged commit 4280c4d into makeplane:preview Jun 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project creation silently fails with React crash when name/identifier contains special characters

6 participants